package org.ider.qiyu.live.id.generate.interfaces.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.ider.qiyu.live.id.generate.interfaces.dao.po.IdGeneratePO;

import java.util.List;

/**
 * @Description: //todo
 * @Author: 张广焱
 * @Date: 2024-04-04 8:19
 */
@Mapper
public interface IdGenerateMapper extends BaseMapper<IdGeneratePO>{
    @Select("select * from t_id_generate_config ")
    List<IdGeneratePO> selectAll();
    @Update("update t_id_generate_config set current_start = next_threshold,next_threshold=current_start+step,version=version+1 where id=#{code}")
    Integer updateNewVersion(@Param("code") Integer code);
}
